package com.ganbo.stock.task;

import com.ganbo.stock.service.impl.DingDingGroupMessageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

/**
 * 对发送失败的钉钉消息进行定时重试
 *
 * @Author: ganbo
 * @Date: 2019/12/2 19:31
 */
@Component
public class DingDingGroupMessageFailRetryTask {

    @Autowired
    DingDingGroupMessageService groupMessageService;


    private boolean isEnd = true;

    @Scheduled(cron = "0/5 * * * * ?")  //每5秒执行一次
    public void groupMessageFailRetryTask() {
        if (isEnd) {
            isEnd = false;
            groupMessageService.groupMessageFailRetry();
            isEnd = true;
        }
    }


}
